//package com.kjc.demo.mybatis.ge.util;
//
//import java.text.SimpleDateFormat;
//import java.util.Date;
//import java.util.HashMap;
//import java.util.Map;
//import java.util.UUID;
//
//import org.springframework.util.LinkedMultiValueMap;
//import org.springframework.util.MultiValueMap;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.alipay.api.AlipayApiException;
//import com.alipay.api.internal.util.AlipaySignature;
//import com.xltech.csp.common.constants.CspConstants;
//
//public class SignGeneraterTestUtil {
//	public static void main(String[] args) {
//		String appid = "201906419016421254";
//		String privateKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCxLPQjtoMz/3JFakZ1hM0JiOCYCLudiaq0MDAgEYlwYJYv9KN0+s68+UpYx+8ueavb4sXo9AwtKZ/JW35VuwVtXM65/YEcV+21D73MCvzM2Qr787vjEnTolBrCrPGevDMXlKahdUmsTkDaInVU7X58SCqDahOuNaSccL1ek/p4akufX5jY2JctkSRFOyWxvNEoQZGFxPmcX0xBAmMeuG3DvOSHmS83/WdGhaloHdYMqoLeS2j8l/yYrYhRXMgozkP/5kyBQ4Xer5XtO2d+Q9CpvwDkCA/VhApPW9ydijh/8KnqijIMvdVM272V5oAWNbUx3LiAcruQsGePXB2hT043AgMBAAECggEBAJwqGGKmC004udrvSn1o+WSPDg9TmzLHVfwOgUyyyGaR668HPU/thW3ReTN5vptDSTS91F15RoZEKv/LMjaUarszU09iX3vBENdHsa34fUx9fg4HjjMeYIdji5bN4wZbsdj2AE1N2QsTylu6hZq+3n7jCP3d8MzboWT2hiOn4NxitRG2lMhxkoAWmkJOY+8hUkmqChmF+eq/Wvz9hjLxJOF1kmfkvOMEZkn1M/jf83NuPXH45l+UjTtvv/QV2Yc3SY8zOFExijpDgjUwBgwDMKkqRIZU2k8csciBDF01XprbbVJVHBGrO4Dz3fN9kXFXjtqCL9lqaI4PJG0RNm1nlNkCgYEA2YibQ94DcLmVRi5qEfCyfTAH/bUXM+a932KUPCGM91PXMLHOQaM0wEqimmhQo4Xf87HbkP9mJsuIlY+6CdtryZI0pByrBETBSxr3nbtNd8r6mXL13W1zMA4ANJdqZFAqdkiggESZZQxfqjZp//bz86SOQJy94KtwB5yEQUzI/H0CgYEA0IFnvLoZ1W3L8y4jXEJ1p32NedRNutt8QL/QQK6iGxUwztTO5l4M6KJgcSPU/u0NAUpJobKvGpPlI2Hcr468b1RIhol38Jzw75l9FvC5Nm3yz284q6aEnWAfvVtzMgBWLfhCWGvGRHloqkAUpaw2jBv1vRoUFamxzIDdWXLy18MCgYEAyEHGDdhYenGeRhl8dD+NUUniUWFgltsYeIkbxa9tQlLgi2dkZXCFo3AR+OuHMMKRxJo7c2Rq+dPtTSIfNevVcp8x7tKlbSyOdUHCKma/jkRCJvl59fpITDjXX5L00pwqOvHpL6v3OtsFRoEJXCZPtkAK5NhmxGmOnLMt3Z9+d1ECgYAbrQGTCHTDYqaOqdIhveSWDdFImYiTw+xzP8Kpw0RbKe3nllG8PEGkY2E/w0zTZa2zPSQW5XveoEDq+GNtnhmfAWX7DaYw9vP4Kbxz3hIHioKPTCkOh7TUmty7qrbYrTjDM0/DItMXZbIh3w2ejARVhqSQrDR8R6EFDxnSdLKNNwKBgE9eeSEcNgWJEVsv8YwFU4YWElKsxd0+C2NeSCd0j/5V73C5vGu0m/WrXjvxT9tB+Y8yskfhhwlds4mxl9V/9TNIFsFd4bU7JEMMVlSRpPYEDYL3tOD3IMgKFGoYe/1P3NGs0tGmAs6TedblTsQsFhAAZSM4UbPMuIsG9KrEU0xp";
//		String uuid = UUID.randomUUID().toString().replace("-", ""); //  fc984b8171ba4ff880abc7c9e6c92ad9
//		String signType = "RSA2";
//		String timestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
//		MultiValueMap<String, String> body = new LinkedMultiValueMap<String, String>();
//		body.add("appid", appid);
//		body.add("nonce_str", uuid);
//		body.add("sign_type", "RSA2");
//		body.add("timestamp", timestamp);
//		body.add("version", "1.0");
//		
//		JSONObject jsonobj = new JSONObject();
//		jsonobj.put("name", "娄兴伟");
//		jsonobj.put("idcard", "230223198804201639");
//		body.add("biz_content", jsonobj.toJSONString());
//		// 生成签名
////		String miyue = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCxLPQjtoMz/3JFakZ1hM0JiOCYCLudiaq0MDAgEYlwYJYv9KN0+s68+UpYx+8ueavb4sXo9AwtKZ/JW35VuwVtXM65/YEcV+21D73MCvzM2Qr787vjEnTolBrCrPGevDMXlKahdUmsTkDaInVU7X58SCqDahOuNaSccL1ek/p4akufX5jY2JctkSRFOyWxvNEoQZGFxPmcX0xBAmMeuG3DvOSHmS83/WdGhaloHdYMqoLeS2j8l/yYrYhRXMgozkP/5kyBQ4Xer5XtO2d+Q9CpvwDkCA/VhApPW9ydijh/8KnqijIMvdVM272V5oAWNbUx3LiAcruQsGePXB2hT043AgMBAAECggEBAJwqGGKmC004udrvSn1o+WSPDg9TmzLHVfwOgUyyyGaR668HPU/thW3ReTN5vptDSTS91F15RoZEKv/LMjaUarszU09iX3vBENdHsa34fUx9fg4HjjMeYIdji5bN4wZbsdj2AE1N2QsTylu6hZq+3n7jCP3d8MzboWT2hiOn4NxitRG2lMhxkoAWmkJOY+8hUkmqChmF+eq/Wvz9hjLxJOF1kmfkvOMEZkn1M/jf83NuPXH45l+UjTtvv/QV2Yc3SY8zOFExijpDgjUwBgwDMKkqRIZU2k8csciBDF01XprbbVJVHBGrO4Dz3fN9kXFXjtqCL9lqaI4PJG0RNm1nlNkCgYEA2YibQ94DcLmVRi5qEfCyfTAH/bUXM+a932KUPCGM91PXMLHOQaM0wEqimmhQo4Xf87HbkP9mJsuIlY+6CdtryZI0pByrBETBSxr3nbtNd8r6mXL13W1zMA4ANJdqZFAqdkiggESZZQxfqjZp//bz86SOQJy94KtwB5yEQUzI/H0CgYEA0IFnvLoZ1W3L8y4jXEJ1p32NedRNutt8QL/QQK6iGxUwztTO5l4M6KJgcSPU/u0NAUpJobKvGpPlI2Hcr468b1RIhol38Jzw75l9FvC5Nm3yz284q6aEnWAfvVtzMgBWLfhCWGvGRHloqkAUpaw2jBv1vRoUFamxzIDdWXLy18MCgYEAyEHGDdhYenGeRhl8dD+NUUniUWFgltsYeIkbxa9tQlLgi2dkZXCFo3AR+OuHMMKRxJo7c2Rq+dPtTSIfNevVcp8x7tKlbSyOdUHCKma/jkRCJvl59fpITDjXX5L00pwqOvHpL6v3OtsFRoEJXCZPtkAK5NhmxGmOnLMt3Z9+d1ECgYAbrQGTCHTDYqaOqdIhveSWDdFImYiTw+xzP8Kpw0RbKe3nllG8PEGkY2E/w0zTZa2zPSQW5XveoEDq+GNtnhmfAWX7DaYw9vP4Kbxz3hIHioKPTCkOh7TUmty7qrbYrTjDM0/DItMXZbIh3w2ejARVhqSQrDR8R6EFDxnSdLKNNwKBgE9eeSEcNgWJEVsv8YwFU4YWElKsxd0+C2NeSCd0j/5V73C5vGu0m/WrXjvxT9tB+Y8yskfhhwlds4mxl9V/9TNIFsFd4bU7JEMMVlSRpPYEDYL3tOD3IMgKFGoYe/1P3NGs0tGmAs6TedblTsQsFhAAZSM4UbPMuIsG9KrEU0xp";
//		String miyue = privateKey;
//		String sign = "";
//		String signStr = AlipaySignature.getSignContent(body.toSingleValueMap());
//		
//		try {
//			sign = AlipaySignature.rsa256Sign(signStr, miyue, "utf-8"); //(body.toSingleValueMap(), miyue, "utf-8");
//		} catch (AlipayApiException e1) {
//			e1.printStackTrace();
//		}
//		body.add("sign", sign);
//		System.out.println(JSON.toJSONString(body,true));
//		String mchPubKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsSz0I7aDM/9yRWpGdYTNCYjgmAi7nYmqtDAwIBGJcGCWL/SjdPrOvPlKWMfvLnmr2+LF6PQMLSmfyVt+VbsFbVzOuf2BHFfttQ+9zAr8zNkK+/O74xJ06JQawqzxnrwzF5SmoXVJrE5A2iJ1VO1+fEgqg2oTrjWknHC9XpP6eGpLn1+Y2NiXLZEkRTslsbzRKEGRhcT5nF9MQQJjHrhtw7zkh5kvN/1nRoWpaB3WDKqC3kto/Jf8mK2IUVzIKM5D/+ZMgUOF3q+V7TtnfkPQqb8A5AgP1YQKT1vcnYo4f/Cp6ooyDL3VTNu9leaAFjW1Mdy4gHK7kLBnj1wdoU9ONwIDAQAB";
//		
//		Map<String, String> returnMap = new HashMap(8);
//        returnMap.put(CspConstants.APPID, appid);
//        returnMap.put(CspConstants.NONCE_STR, uuid);
//        returnMap.put(CspConstants.SIGN_TYPE, signType);
//        returnMap.put(CspConstants.SIGN, sign);
//        returnMap.put(CspConstants.TIMESTAMP, timestamp);
//        returnMap.put(CspConstants.VERSION, "1.0");
//        returnMap.put(CspConstants.BIZ_CONTENT_KEY, jsonobj.toJSONString());
//		try {
//			boolean checkResult = AlipaySignature.rsaCheckV2(returnMap, mchPubKey, "UTF-8", "RSA2");
//			System.out.println(checkResult);
//		} catch (AlipayApiException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//	}
//}
